package java3_22.Teacher;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

public class Teacher {
    public static final Logger Log = LoggerFactory.getLogger("java3_22.Teacher.Teacher");
    private String name;
    private int age;
    private String school;

    public Teacher(String name, String school) {
        this.name = name;
        this.school = school;
    }

    public void print(){
        System.out.println("同学们好！我是Java老师:"+getName()+"\n"+"年龄是:"+getAge()
        +"\n"+"来自:"+getSchool());
    }
    public void attendClass(){
        System.out.println("现在开始上课！");
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws Exception {
        if (Log.isDebugEnabled()) {
            if (age < 22) {
                throw new Exception("年龄不合法！");
            }
            this.age = age;
        }
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }
}
